﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace HZ.Supervise.Web.Message
{
    public partial class GoodsWarningList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BindList();
            GetWarningCount();
        }
        void BindList()
        {
            DataTable dt = new DataTable();
            DataColumn dc1 = new DataColumn("WarningDepart", typeof(string)); dt.Columns.Add(dc1);
            DataColumn dc2 = new DataColumn("Sort", typeof(string)); dt.Columns.Add(dc2);
            DataColumn dc3 = new DataColumn("GoodsName", typeof(string)); dt.Columns.Add(dc3);
            DataColumn dc4 = new DataColumn("WarningCount", typeof(string)); dt.Columns.Add(dc4);
            DataColumn dc5 = new DataColumn("type", typeof(string)); dt.Columns.Add(dc5);
            DataColumn dc6 = new DataColumn("time", typeof(string)); dt.Columns.Add(dc6);
            DataColumn dc7 = new DataColumn("level", typeof(string)); dt.Columns.Add(dc7);
            DataColumn dc8 = new DataColumn("IsCheck", typeof(string)); dt.Columns.Add(dc8);
            for (int i = 0; i < 10; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = "昆明第" + i.ToString() + "医院";
                dr[1] = "精神" + i.ToString();
                dr[2] = "药品" + i.ToString();
                dr[3] = "888888";
                dr[4] = "企业确认但没审核";
                dr[5] = "2010-5-25";
                dr[6] = "一级预警";

                if (Request.QueryString["id"] != null)
                {
                    dr[7] = "未处理";
                }
                else
                {
                    dr[7] = "已处理";
                }

                dt.Rows.Add(dr);
            }
            gvwWaringList.DataSource = dt;
            gvwWaringList.DataBind();
        }
        /// <summary>
        /// 获取每个预警的数量
        /// </summary>
        void GetWarningCount()
        {
            lblHospitlWarning.Text = "12";
            lblAreaWarning.Text = "22";
            lblCompanyWarning.Text = "55";
            lblGoodsWarning.Text = "0";
            lblTimeWarning.Text = "29";
        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindList();
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            BindList();
        }
    }
}
